//5:6月的第3个星期日是父亲节，由用户输入年份，算出该年的父亲节是哪一天
package Work0529;

import java.util.Calendar;
import java.util.Scanner;

public class FatherDay {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("请输入年份:");
		int y = in.nextInt();
		Calendar fa = Calendar.getInstance();
		fa.set(Calendar.YEAR, y);
		fa.set(Calendar.MONTH, 5);
		fa.getActualMaximum(Calendar.DATE);
		int sunday = 0;
		for (int i = 1; i <= fa.getActualMaximum(Calendar.DATE); i++) {
			fa.set(Calendar.DATE, i);
			if (fa.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
				sunday++;
			}
			if (sunday == 3) {
				break;
			}
		}
		System.out.println("父亲节当天为" + fa.getTime());

	}
}
